<template>
	<div class="form-control">
		<el-form :model="stage" label-width="auto">
			<el-form-item label="阶段名称">
				<el-input
					 v-model.trim="stage.name"
					 type="text"
					 placeholder="请输入阶段名称"
				  />
			</el-form-item>
		</el-form>
	</div>
</template>

<script>
export default {
	data(){
		return {
			stage: {
				name: null,
			}
		}
	},
    created() {
      window.$bus.on("add-stage", this.saveStage)
    },
  methods: {
    saveStage(index) {
      if (this.stage.name === "") {
        this.$layer.msg("阶段名不允许为空")
      }
      // 调用接口完成添加
      this.$api.saveStage(this.stage).then(ret => {
        parent.$bus.emit('close-win-refresh', index);
      })
    }
  }
}
</script>

<style scoped>
.form-control {
	padding: 30px 30px 10px;
}
</style>